﻿using System.Reflection;
using Autofac;

namespace Portal.Repository.Bootstraper
{
	public class RepositoryRegistrationModule : Autofac.Module
	{
		protected override void Load(ContainerBuilder builder)
		{
			var dataAccess = Assembly.GetExecutingAssembly();

			builder.RegisterAssemblyTypes(dataAccess)
				.Where(t => t.Name.EndsWith("UnitOfWork"))
				.AsImplementedInterfaces();

			builder.RegisterAssemblyTypes(dataAccess)
				.Where(t => t.Name.EndsWith("UnitOfWorkProvider"))
				.AsImplementedInterfaces();
			
		}

	}
}